/**
 * Created by Administrator on 2017/7/6.
 */
// 权限控制指令实现
export default {}.install = (Vue, options = {}) => {
  // dom节点显示与隐藏
  function patch(passVerify, el) {
    if(el) {
      if(passVerify == '-1') {
        el.style.display = 'none';
      }
    }
  }
  Vue.directive('auth', {
    bind(el, binding, vnode) {
      const sTran = JSON.stringify;
      const limitStr = sTran(binding.value);
      const limitArr = limitStr.split("|");
      const passVerify = limitArr.indexOf(el.getAttribute('data-role'));
      patch.call(this, passVerify, el)
    }
  })
}








